Satellite Example

Consider launching three satellites, each with a probability of 0.9 of reaching proper orbit. We can model the pmf of the random variable \(X\), the number of successful orbits. This will also give us the cdf of \(X\).

  x = 0:3
  p = c((1-0.9)^3, 3*0.9*0.1^2, 3*0.9^2*0.1, 0.9^3)
  
  ### It's easier to read if x and p are side-by-side.
  cbind(x,p)
##      x     p
## [1,] 0 0.001
## [2,] 1 0.027
## [3,] 2 0.243
## [4,] 3 0.729
  ### We can also store the information in a data frame.  Note the use of capital X.
  X = data.frame(x,p)
  
  ### The relationship between x and p can be plotted.  Graph the pmf.
  plot(x, p, type="p", pch=16)
  points(x, p, type="h")

The cdf can be obtained from the pmf.

  X$F = cumsum(X$p)
  X
##   x     p     F
## 1 0 0.001 0.001
## 2 1 0.027 0.028
## 3 2 0.243 0.271
## 4 3 0.729 1.000
  plot(c(-1,X$x,4), c(0,X$F,1),type="s", ylab="F(x)", xlab="x")
  points(X$x, X$p)